#include "Callback.h"

namespace UniverseSound
{
	template<typename T>
	class CallbackPointer
	{
		typedef void (T::*MemberFunction)(SoundClip* sound);

		CallbackPointer::CallbackPointer() : mUndefined(true)
		{
		}

		CallbackPointer::CallbackPointer(MemberFunction func, T* obj) : mFunction(func), mObject(obj), mUndefined(false)
		{
		}

		virtual ~CallbackPointer()
		{
		}

		void execute(SoundClip *sound)
		{
			if (!mUndefined) 
			{
				(mObject->*mFunction)(sound);
			}
		}
	}
}